package me.Adventure;

import java.util.ArrayList;

import me.model.Brick;
import me.model.Room;

import org.newdawn.slick.SlickException;

public class BrickMap {

	private int brick[] = {1,1,21,1,21,21,1,21}; //square shaped tile
	public static ArrayList<Brick> entities;

	public BrickMap(int screenCode) throws SlickException {
		
		int posX = 0;
		int posY = 0;
		
		entities = new ArrayList<Brick>();
		int cont = 0;
		
		String charMap = getBrickMap(screenCode);
		
		while(cont != charMap.length()){
			
			char tileChar = charMap.charAt(cont);
			if (tileChar == '0') {
				entities.add(new Brick(posX, posY, brick, "brick"));
			}

			posX+=Adventure.squareWidth;

			if(posX == Adventure.SCREEN_WIDTH){
				posX = 0;
				posY+= Adventure.squareHeight;
			}

			cont++;
		}
				
	}
	
	public String getBrickMap(int screencode){
		
		Room room = Room.getInstance();
		String charScenario = room.getScreen(screencode).toString();
		
		return charScenario;
		
	}
	
}